# !/usr/bin python3
# encoding: utf-8 -*-
# @file : matla.py
# @author : hailiang.ji
# @Time : 2023/10/25 8:30
import numpy
from matplotlib import pyplot as plt

def matb(data,save_path,image_name):
    maxx = max(data)
    minn = min(data)
    aver = round(sum(data)/len(data),2)
    sigma = numpy.percentile(data,97)
    plt.xlabel('count')
    plt.ylabel('value')
    plt.yticks([x for x in range(20)])
    plt.plot(data)
    plt.title(f'{image_name}')
    plt.text(0,6,f'max={maxx}\n'
                 f'min={minn}\n'
                 f'aver={aver}\n'
                 f'1sigam={numpy.percentile(data,68)}'
             )
    plt.savefig(f'./log/test_log/{image_name}.png')
    # plt.show()
    return maxx, minn,sigma
# if __name__ == '__main__':
#     data = [1, 2, 3,45, 6, 7]
#     print(max(data))
#     save_path = r'../log/test_log'
#     image_name = 'check_cpu'
#     matb(data=data,save_path=save_path,image_name=image_name)